package option;

import Book.BookList;
import Book.Book;
import java.util.Scanner;

public class Return implements MY{
    @Override
    public void work(BookList booklist) {
        System.out.println("归还图书");
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入你要归还的图书名");
        String name=scanner.nextLine();
        int size=booklist.getUsedSize();
        for(int i=0;i<size;i++){
            Book book=booklist.getBooks(i);
            if(book.getName().equals(name)){
                book.setIsborrowed(false);
                System.out.println("归还成功");
                System.out.println(book);
                return;
            }
        }
        System.out.println("你要归还的图书不存在");
    }
}